const express = require('express')
const cors = require('cors')
const fileUpload = require('express-fileupload')
const app = express()
const addServices = require('./service')

app.use(cors())
app.use(fileUpload({ createParentPath: true }))
app.use(express.json())
app.use('/img', express.static('img'))

addServices(app)

const hostname = '127.0.0.1'
const port = 3001

app.listen(port, hostname, () => {
  console.log(`Server is running at http://${hostname}:${port}/`)
})
